part of 'widgets.dart';

enum VanType {
  defaults,
  primary,
  success,
  warning,
  danger;

  static get(dynamic value, {Type? type, String? tag, VanHorizontalAlign? orElse}) {
    if (value == "default") return defaults;
    return parseEnum(value, values: values, type: type, tag: tag, orElse: orElse);
  }
}

enum VanHorizontalAlign {
  left,
  center,
  right;

  static get(dynamic value, {Type? type, String? tag, VanHorizontalAlign? orElse}) {
    return parseEnum(value, values: values, type: type, tag: tag, orElse: orElse);
  }

  TextAlign get textAlign {
    if (center == this) return TextAlign.center;
    if (right == this) return TextAlign.right;
    if (left == this) return TextAlign.left;
    return TextAlign.left;
  }

  Alignment get alignment {
    if (center == this) return Alignment.center;
    if (right == this) return Alignment.centerRight;
    if (left == this) return Alignment.centerLeft;
    return Alignment.centerLeft;
  }
}

enum VanVerticalAlign {
  top,
  center,
  bottom;

  static get(dynamic value, {Type? type, String? tag, VanVerticalAlign? orElse}) {
    return parseEnum(value, values: values, type: type, tag: tag, orElse: orElse);
  }

  Alignment get alignment {
    if (center == this) return Alignment.center;
    if (top == this) return Alignment.topCenter;
    if (bottom == this) return Alignment.bottomCenter;
    return Alignment.center;
  }
}
